#include<stdio.h>
#include<string.h>
//int my_strcmp(const char* p1, const char* p2)
//{
//	while (*p1 == *p2)
//	{
//		if (*p1 == '\0' && *p2 == '\0')
//			return 0;
//		p1++;
//		p2++;
//	}
//	if (*p1 > *p2)
//		return 1;
//	if (*p1 < *p2)
//		return -1;
//}
//int main()
//{
//	char arr1[] = "abcdef";
//	char arr2[] = "abcd";
//	int ret = my_strcmp(arr1, arr2);
//	printf("%d\n", ret);
//	return 0;
//}
char* my_strstr(const char* p1, const char* p2)
{
	char* s1 = NULL;
	char* s2 = NULL;
	char* cur = p1;
	while (*cur!='\0')
	{
		s1 = cur;
		s2 = p2;
		while(*s2!='\0' && *s1 == *s2)
		{
			s1++;
			s2++;
		}
		if (*s2 == '\0')
			return cur;
		cur++;
	}
	return NULL;
}
int main()
{
	char arr1[] = "aaaabcdeffff";
	char arr2[] = "abcde";
	char* ret = my_strstr(arr1, arr2);
	printf("%s\n", ret);
	return 0;
}

//int main()
//{
//	char arr1[] = "aaababcdefff";
//	char arr2[] = "abcdef";
//	char* ret = strstr(arr1, arr2);
//	printf("%s\n", arr1);
//	return 0;
//}